import cv2
image=cv2.imread("campus.png")
image_Gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
t1,dst1=cv2.threshold(image_Gray,127,255,cv2.THRESH_BTNARY)
t2,dst2=cv2.threshold(image_Gray,0,255,cv2.THRESH_BTNARY+cv2.THRESH_OTSU)

cv2.imgshow('input',image)
cv2.imgshow('binary',dst1)
cv2.imgshow('otsu',dst2)
cv2.waitkey()
cv2.destroyAllWindows